<script setup>
import { ref } from 'vue'
import GunDaily from '../components/gun/GunDaily.vue'
import chardata from '../data/GunCharacterData.json'
import dailylist from '../data/CharacterDailyByGunIdData.json'
import { getParsedText } from '../store/txtstore'

const chara = chardata.data[17]
const viewDaily = ref(false)
</script>

<template>
  <h1>美玲</h1>
  <article>
    <template v-if="!viewDaily">
      <img :src="`/exilium/icons/avatar/Avatar_Head_${chara[4]}.png`">
      <table>
        <tr>
          <th>中配</th>
          <td>{{ getParsedText(chara[12]?.[1]) }}</td>
        </tr>
        <tr>
          <th>日配</th>
          <td>{{ getParsedText(chara[13]?.[1]) }}</td>
        </tr>
      </table>
      <div>
        <h2>个人介绍</h2>
        <p>{{ getParsedText(chara[11]?.[1]) }}</p>
      </div>
    </template>
    <button @click="() => viewDaily = !viewDaily">{{ viewDaily ? '返回' : '日志' }}</button>
    <GunDaily :ids="dailylist[101]" v-if="viewDaily" />
  </article>
</template>

<style scoped>
th {
  font-weight: bold;
}
</style>